
<h1>Editer la séance</h1>
<div class="bloc">
<div class="formFilter">﻿
<?php
include("view/Filtre.php");
# afficher la liste des s�ances(utiliser $data)
?>
</div>
    <div class="">    
        <?php
            include("view/listeSeances.php");
        ?>    
    </div>
</div>
<div >    
<form method="POST" action="index.php?controller=Seance&action=updateSeance&id=<?php echo $seanceTd["idSeance"];?>">
<div class="resultats">   
    <?php echo isset($msgErreur)?"<p class=\"msgErreur\">$msgErreur</p>":"";?>
<table>
    <tr>
        <th>
             <label for="dateSeance">Date Seance</label>
        </th>
        <td>
             <input <?php echo $form->getErreur("dateSeance")?"class='champObligatoire'":""; ?>  type="text" size="20" name="dateSeance" class="date"  style="cursor: text" value="<?php echo $form->getDateSeance(); ?>" /><br />
        </td>
    </tr>
    <tr>
        <th>
             <label for="libelleSeance">Intitulé séance</label>
            
        </th>
        <td>
             <input type="text" size="20" name="libelleSeance" <?php echo $form->getErreur("libelleSeance")?"class='champObligatoire'":""; ?>  style="cursor: text" value="<?php echo $form->getLibelleSeance(); ?>" /><br />
            
        </td>
    </tr>
    <tr>
        <th>
             <label for="numero">Numéro séance</label>
        </th>
        <td>
             <input type="text" size="20" name="numero" <?php echo $form->getErreur("numero")?"class='champObligatoire'":""; ?>  style="cursor: text" value="<?php echo $form->getNumero(); ?>" /><br />
            
        </td>
    </tr>    
    <tr>
        <th>
             Matière (EP)
        </th>
        <td>
           <input type="hidden" name="numEp" value="<?php echo $seanceTd["numEP"]; ?>"/>
            <?php 
            foreach ($listEP as $key => $ep) {
                       echo ($ep["numEP"]==$seanceTd["numEP"]?$ep["libelleEP"]:"");
            }
            /*<select name="numEp" id="fieldEp">
                            <option value=""></option>
                        <?php foreach ($listEP"] as $key => $ep) {
                        ?><option value='<?php echo $ep["numEP"] ?>' <?php echo ($ep["numEP"]==$seanceTd["numEP"]?"selected='selected'":"") ?> ><?php echo $ep["libelleEP"]?></option>
                        <?php }?>
            </select> */?>
            
        </td>
    </tr>  
    <tr>
                <th>
                    Groupe:
                </th>
                <td>
                   <input type="hidden" name="idGroupe" value="<?php echo $seanceTd["idgrp"]; ?>"/>
                    <?php 
                    foreach ($listGroupes as $key => $groupe) {
                       echo ($groupe["idgrp"]==$seanceTd["idgrp"]?$groupe["numgrp"]:"");
                    }
                    /*<select name="idGroupe" id="fieldGroupe">
                        <option value=""></option>
                        <?php foreach ($listGroupes"] as $key => $groupe) {
                                ?><option value='<?php echo $groupe["idgrp"] ?>' <?php echo ($groupe["idgrp"]==$seanceTd["idgrp"]?"selected='selected'":"") ?> ><?php echo $groupe["numgrp"]?></option>
                        <?php }?>
                    </select>*/?>

                </td>
      </tr>
    
</table>
        <br/>

</div>
<div class="resultats ">
<table class="scrollTable liste">
<thead>    
<tr><th>Nom</th><th>Prenom</th><th>GroupeTd</th><th>Présence</th></tr>
</thead>
<tbody>
<?php foreach ($listEtudiant as $key => $etudiant) {?>
<tr>
    <td><?php echo $etudiant["NomUtilisateur"];?></td><td><?php echo $etudiant["PrenomUtilisateur"];?></td>
    <td>
        <?php 
            $grp= $bda->getGroupeByEtuEP($etudiant["NumEtudiant"],isset($formFilter)?$formFilter->getNumEp():$numEP) ;
            echo ($grp?$grp["numgrp"]:""); 
        ?>
    </td>
    
    <td>
        
        <?php $presence =$bda->getPresence($etudiant["NumEtudiant"],$seanceTd["idSeance"]) ;?>
        <select name="presences[<?php echo $etudiant["NumEtudiant"] ;?>]">
            <option value="" ></option>            
            <option class="P_green" value="P" <?php echo ("P"==$presence["presence"]?"selected='selected'":"") ?>>Présent</option>
            <option class="R_yellow" value="R" <?php echo ("R"==$presence["presence"]?"selected='selected'":"") ?>>Retard</option>
            <option class="ABJ_orange" value="ABJ"<?php echo ("ABJ"==$presence["presence"]?"selected='selected'":"") ?>>Absent justifiée</option>
            <option class="AB_red" value="AB" <?php echo ("AB"==$presence["presence"]?"selected='selected'":"") ?>>Absence </option>
        
        </select>
    </td>
</tr>
<?php }?>
</tbody>

</table>
    <input type="hidden" name="idSeance" value="<?php echo $seanceTd["idSeance"]; ?>"/>
<br/>
<input type="submit" class="right btn btn-default" value="Modifier"/>
</div>
</form>
    
</div>
<script language="javascript">
$( document ).ready((function() {
    $("#fieldEp").change(function () {
        $( "#fieldGroupe" ).load( "index.php?controller=seance&action=ajaxGetGroupes&numEp="+$("#fieldEp").val());
    });
}));
</script>
